<template>
	<view class="page">
		<view class="my-card" style="">
			<view class="text-white">
				<text v-if="!hasTask" class="zwrw">暂无任务</text>
				<view v-else>
					<view class="title_body">
						<text class="title">{{task.name}}</text>
						<button @click="see_detail(task.ucId)" class="cu-btn round my-btn">查看</button>
					</view>
					<view class="content">
						<text>所属企业：{{task.name}}</text>
						<text>执行时间：{{task.name}}</text>
					</view>
				</view>
			</view>
		</view>


		<view class="u-tools">
			<view>
				<text class="tools-title">任务管理</text>
				<view class="bg-1" style="" @click="jdjc">
					<text class="tools-desc">监督检查</text>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		created() {
			console.info("ahome create")

			this.getTask()

			let that = this
			uni.$on('refreshPage', function() {
				that.getTask()
			})
		},
		data() {
			return {
				hasTask: true,
				task: ''
			}
		},
		methods: {
			getTask() {
				let that = this
				let params = {
					"pageNum": 1,
					"pageSize": 1,
					"status":1
				}
				// 请求数据
				let app = getApp()
				app.globalData.request({
					url: 'wx/taskmanage/getMyTaskEnterprisePage',
					data: {
						...params
					}
				}).then(function(res) {
					if (res.data.data.list.length > 0) {
						that.hasTask = true
						that.task = res.data.data.list[0]
					} else {
						that.hasTask = false
					}

				}).catch(function(e) {
					that.hasTask = false
				})
			},
			jdjc() {
				uni.navigateTo({
					url: '/jcqy/jcrw/jcrw'
				})
			},
			see_detail(ucId) {
				uni.navigateTo({
					url: '/jcqy/jcxq/jcxq?ucId=' + ucId
				})
			}
		}
	}
</script>

<style scoped>
	.page {
		margin: 0 24rpx;
		margin-top: 39rpx;
		height: 400px;
	}

	.my-card {
		height: 320rpx;
		border-radius: 25upx;
		padding: 24upx 50upx;
		background: url('https://tvax3.sinaimg.cn/large/005Tv2WXgy1h0l6920jw0j309r04g3z1.jpg') no-repeat;
		background-size: cover;
	}

	.title_body {
		font-family: PingFangSC-Medium;
		font-size: 36rpx;
		color: #FFFFFF;
		text-align: left;
		margin: 40upx 0;

	}

	.my-btn {
		float: right;
		font-size: 24rpx;
		color: #3013F7;
		height: 50rpx;
	}

	.content {
		font-family: PingFangSC-Medium;
		font-size: 24rpx;
		color: #FFFFFF;
		letter-spacing: 0.39px;
		text-align: left;
		line-height: 24rpx;
		display: flex;
		flex-direction: column;
	}

	.content text {
		margin: 6px 0;
	}

	.u-tools {
		display: flex;
		flex-direction: row;
		margin-top: 40upx;
	}

	.tools-title {
		font-size: 32rpx;
		color: #777777;
		font-weight: 600;
	}

	.tools-desc {
		font-size: 28rpx;
		color: #333333;
		/* height: 160rpx; */
		width: 100%;
		display: inline-block;
		font-weight: 600;

		margin-left: 420rpx;
	}

	.u-tools view {
		flex: 1;

	}

	.bg-1 {
		height: 280rpx;
		border-radius: 15px;
		background: url(@/static/home/bHome/icon_jiandujiancha.png) no-repeat -2px 5px;
		background-size: cover;
		display: flex;
		justify-content: center;
		align-items: center;

	}

	.zwrw {
		font-size: 48rpx;
	}
</style>
